package com.ocean.actionAware;

import java.util.Map;

import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;

public class TestActionAwareAction implements ApplicationAware,SessionAware,RequestAware,ParameterAware{
	
	Map<String, Object> application = null;
	
	Map<String, Object> session = null;
	
	Map<String, Object> request = null;
	
	Map<String, String[]> parameters = null;
	
	public String execute(){
		application.put("applicationKey", "applicationAwareValue");
		
		session.put("sessionKey", "sessionAwareValue");
		
		request.put("requestKey", "requestAwareValue");
		
		String name = ((String[])parameters.get("name"))[0];
		System.out.println("name:" + name);
		
		return "success";
	}

	@Override
	public void setParameters(Map<String, String[]> parameters) {
		
		this.parameters = parameters;
		
	}

	@Override
	public void setRequest(Map<String, Object> request) {
		this.request = request;
		
	}

	@Override
	public void setSession(Map<String, Object> session) {
		this.session = session;
		
	}

	@Override
	public void setApplication(Map<String, Object> application) {
		this.application = application;
		
	}

}
